# shttpd - build system -- list of dependencies
# Copyright (C) 2018-2019 Ariadne Devos
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# % rules are a GNUism, except if they are POSIX. No Internet at the
# moment. So no -Wportability
AUTOMAKE_OPTIONS = subdir-objects foreign no-dist \
 -Wobsolete -Woverride -Wunsupported -Werror

AM_CPPFLAGS = -D_GNU_SOURCE

bin_PROGRAMS = shttpd
shtsources = \
  bitops/zero-index/any.c \
  buffer/append.c \
  buffer/lex.c \
  buffer/memeq.c \
  buffer/phash.c \
  buffer/skip.c \
  fd/fd.c \
  fd/inet.c \
  generic/bug.c \
  http/scheme-hash.c \
  http/method-hash.c \
  http/header-hash.c \
  task/accept.c \
  task/perform.c \
  task/sockrw.c \
  task/stream.c \
  worker/alloc.c \
  worker/block-mmap.c \
  worker/edge-epoll.c \
  worker/loop.c \
  worker/objcache.c \
  worker/schedule.c \
  worker/vector.c

%-hash.c: %.sh buffer/gen-phash.sh
	bash $(srcdir)/buffer/gen-phash.sh --gen $< > $@T && mv $@T $@

worker/objcache.c: worker/objcache-bless-table.c
	touch -c $@
worker/objcache-bless-table.c: tools/gen-vector-variants.sh
	$< size sHT_objcache_bless objcache-bless.c > $@T && mv -T $@T $@

shttpdsources = \
  http/accept.c \
  http/stream.c

shttpd_SOURCES = $(shtsources) $(shttpdsources)
